package com.hmall.common.client;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @Description ItemClient
 * @Author GGBond
 * @Date 2024-11-15
 */
@FeignClient("itemservice")
public interface ItemClient {

    /**
     * 分页查询
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/item/list")
    PageDTO<Item> list(@RequestParam("page") Integer pageNum, @RequestParam("size") Integer pageSize);


    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/item/{id}")
    Item getById(@PathVariable Long id);


    /**
     * 扣减库存接口
     * @param itemId
     * @param num
     */
    @PutMapping("/item/stock/{itemId}/{num}")
    public void stockNum(@PathVariable Long itemId,@PathVariable Integer num);


    /**
     * 修改商品
     * @param item
     */
    @PutMapping("/item")
    public void updateItem(@RequestBody Item item);
}
